home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / CURS_SET.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  76 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3. #undef curs_set
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid_curs_set = "$Header: c:/curses/portable/RCS/curs_set.c%v 2.0 1992/11/15 03:29:14 MH Rel $";
  7. #endif
  8.  
  9.  
  10. /*man-start*********************************************************************
  11.  
  12.   curs_set()   - set visibility of cursor.
  13.  
  14.   X/Open Description:
  15.        This routine is used to set the visibility of the cursor. The cursor
  16.        can be made invisible, normal or highly visible by setting the
  17.        parameter to 0, 1 or 2 respectively. If an invalid value is passed
  18.        the function will set the cursor to "normal".
  19.  
  20.   X/Open Return Value:
  21.        No return value.
  22.  
  23.   X/Open Errors:
  24.        No errors are defined for this function.
  25.  
  26.   Portability:
  27.        PDCurses        int curs_set( int visibility );
  28.        SYS V Curses    int curs_set( int visibility );
  29.  
  30. **man-end**********************************************************************/
  31.  
  32. int    curs_set(int visibility)
  33. {
  34. #ifdef OS2
  35.  VIOCURSORINFO pvioCursorInfo;
  36. #endif
  37.  int start,end,hidden=0;
  38.  
  39.        switch(visibility)
  40.        {
  41.                case 0:  /* invisible */
  42. #ifdef OS2
  43.                        start = _cursvar.font / 4;
  44.                        end = _cursvar.font;
  45. #else
  46.                        start = 32;
  47.                        end = 33;
  48. #endif
  49.                        hidden = (-1);
  50.                        break;
  51.                case 2:  /* highly visible */
  52.                        start = _cursvar.font / 4;   /* 3/4 high block */
  53.                        end = _cursvar.font;
  54.                        break;
  55.                default:  /* normal visibility */
  56.                        start = _cursvar.font - 2;
  57.                        end = _cursvar.font;
  58.                        break;
  59.        }
  60. #ifdef OS2
  61.        pvioCursorInfo.yStart = (USHORT)start;
  62.        pvioCursorInfo.cEnd = (USHORT)end;
  63.        pvioCursorInfo.cx = (USHORT)1;
  64.        pvioCursorInfo.attr = hidden;
  65.        VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo,0);
  66. #endif
  67. #ifdef DOS
  68.        regs.h.ah = 0x01;
  69.        regs.h.al = (unsigned char)_cursvar.scrnmode;  /* if not set, some BIOSes hang */
  70.        regs.h.ch = (unsigned char)start;
  71.        regs.h.cl = (unsigned char)end;
  72.        int86(0x10, ®s, ®s);
  73. #endif
  74.        return( OK );
  75. }
  76.